package ys.ewp.dto;

import java.util.Date;

import ys.ewp.po.Employee;

public class EmployeeDto {
	
	//ID
	private Integer id;
	//员工姓名
	private String realName;
	//员工性别
	private String sex;
	//手机
	private String mobile;
	//邮箱
	private String email;
	//部门ID
	private Integer depId;
	//部门名称
	private String depName;
	//职位
	private String position;
	//备注
	private String remark;
	//创建时间
	private Date dateCreated;
	//更新时间
	private Date dateUpdated;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getRealName() {
		return realName;
	}
	public void setRealName(String realName) {
		this.realName = realName;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Integer getDepId() {
		return depId;
	}
	public void setDepId(Integer depId) {
		this.depId = depId;
	}
	public String getDepName() {
		return depName;
	}
	public void setDepName(String depName) {
		this.depName = depName;
	}
	public String getPosition() {
		return position;
	}
	public void setPosition(String position) {
		this.position = position;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public Date getDateCreated() {
		return dateCreated;
	}
	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}
	public Date getDateUpdated() {
		return dateUpdated;
	}
	public void setDateUpdated(Date dateUpdated) {
		this.dateUpdated = dateUpdated;
	}
	
	/**
	 * @功能 根据员工PO对象获得员工DTO对象
	 */
	public static EmployeeDto getDtoByPo(Employee emp){
		EmployeeDto empDto = new EmployeeDto();
		
		empDto.setId(emp.getId());
		empDto.setRealName(emp.getRealName());
		empDto.setSex(emp.getSex());
		empDto.setMobile(emp.getMobile());
		empDto.setEmail(emp.getEmail());
		empDto.setDepId(emp.getDepartment().getId());
		empDto.setDepName(emp.getDepartment().getName());
		empDto.setPosition(emp.getPosition());
		empDto.setRemark(emp.getRemark());
		empDto.setDateCreated(emp.getDateCreated());
		empDto.setDateUpdated(emp.getDateUpdated());
		
		return empDto;
	}
	
	/**
	 * @功能 根据员工DTO对象获得员工PO对象
	 */
	public static Employee getPoByDto(EmployeeDto empDto){
		Employee emp = new Employee();
		
		emp.setRealName(empDto.getRealName());
		emp.setSex(empDto.getSex());
		emp.setMobile(empDto.getMobile());
		emp.setEmail(empDto.getEmail());
		emp.setRemark(empDto.getRealName());
		//emp.setDepartment(dep);
		emp.setPosition(empDto.getPosition());
		
		return emp;
	}
	
}
